﻿     namespace ImageProcessing.UI
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    /// <summary>
    /// IMG_Slicing class
    /// </summary>
    public partial class IMG_Slicing : Form
    {
        /// <summary>
        /// parent Form referance
        /// </summary>
        private UI.IMG_GrayScaleScreen parentForm;

        /// <summary>
        /// Initializes a new instance of the <see cref="IMG_Slicing"/> class.
        /// </summary>
        /// <param name="imgOriginal">The img original.</param>
        /// <param name="parent">The parent.</param>
        public IMG_Slicing(Entities.IMG_Image imgOriginal, UI.IMG_GrayScaleScreen parent)
        {
            this.parentForm = parent;
            this.InitializeComponent();
            ImageProcessor.IMG_Slicing slice = new ImageProcessor.IMG_Slicing(imgOriginal);
            try
            {
                this.pictureBoxSlice0.Image = IMG_Processor.IMG_OpenSave.IMG_BufferToBItmap(slice.Slice0);
                this.pictureBoxSlice1.Image = IMG_Processor.IMG_OpenSave.IMG_BufferToBItmap(slice.Slice1);
                this.pictureBoxSlice2.Image = IMG_Processor.IMG_OpenSave.IMG_BufferToBItmap(slice.Slice2);
                this.pictureBoxSlice3.Image = IMG_Processor.IMG_OpenSave.IMG_BufferToBItmap(slice.Slice3);
                this.pictureBoxSlice4.Image = IMG_Processor.IMG_OpenSave.IMG_BufferToBItmap(slice.Slice4);
                this.pictureBoxSlice5.Image = IMG_Processor.IMG_OpenSave.IMG_BufferToBItmap(slice.Slice5);
                this.pictureBoxSlice6.Image = IMG_Processor.IMG_OpenSave.IMG_BufferToBItmap(slice.Slice6);
                this.pictureBoxSlice7.Image = IMG_Processor.IMG_OpenSave.IMG_BufferToBItmap(slice.Slice7);
            }
            catch (Exception img_Ex)
            {
                Logger.LogException(img_Ex);
                MessageBox.Show("ERROR!! Slicing the Image");
            }
        }
    }
}
